package com.b.dao;

import com.b.domain.VideoTagRelation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface VideoTagRelationMapper {
    /**
     * delete by primary key
     *
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(VideoTagRelation record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(VideoTagRelation record);

    /**
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    VideoTagRelation selectByPrimaryKey(Integer id);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(VideoTagRelation record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(VideoTagRelation record);

    @Select("select * from video_tag_relation")
    List<VideoTagRelation> getAll();

    /**
     * 根据视频id删除所有关联关系
     * @param videoId
     */
    @Delete("delete from video_tag_relation where video_id = #{videoId}")
    void deleteByVideoId(Integer videoId);
}